CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
SET(CMAKE_CXX_COMPILER "g++")
SET(CMAKE_C_COMPILER "gcc")
PROJECT(CProj)
SET(CMAKE_CXX_FLAGS "-g -O2 -std=c++17")
SET(PATH_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
SET(EXECUTABLE_OUTPUT_PATH .)
SET(LIBRARY_OUTPUT_PATH .)

AUX_SOURCE_DIRECTORY(${PATH_PREFIX}/reactor CPROJ_REACTOR_SRC_LIST)
AUX_SOURCE_DIRECTORY(${PATH_PREFIX}/server CPROJ_SERVER_SRC_LIST)
AUX_SOURCE_DIRECTORY(${PATH_PREFIX}/client CPROJ_CLIENT_SRC_LIST)

INCLUDE_DIRECTORIES(
${PATH_PREFIX}
)

LINK_DIRECTORIES(
)

ADD_DEFINITIONS(-D_LINUX_VERSION)
ADD_DEFINITIONS(-D_LINUX_SYS)

ADD_LIBRARY(rector STATIC ${CPROJ_REACTOR_SRC_LIST})

ADD_EXECUTABLE(server ${CPROJ_SERVER_SRC_LIST})
TARGET_LINK_LIBRARIES(server rector pthread)

ADD_EXECUTABLE(client ${CPROJ_CLIENT_SRC_LIST})
TARGET_LINK_LIBRARIES(client pthread)
